package top.fengleifeng.question;

/**
 * @program: leetcode-test
 * @description:
 * @author: fengleifeng
 * @create: 2020-09-30 17:27
 **/
public class Num1401圆和矩形是否有重叠 {

    class Solution {
        public boolean checkOverlap(int radius, int x_center, int y_center, int x1, int y1, int x2, int y2) {


            int dx = x1 > x_center ? x1 - x_center : x2 < x_center ? x_center - x2 : 0;
            int dy = y1 > y_center ? y1 - y_center : y2 < y_center ? y_center - y2 : 0;

            return dx*dx +dy*dy<=radius*radius;
        }
    }
}
